home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Diamond Collection / The Diamond Collection (Software Vault)(Digital Impact).ISO / cdr05 / att33all.zip / ATOMIC.FRM < prev    next >
Text File  |  1995-02-08  |  21KB  |  669 lines

  1. VERSION 2.00
  2. Begin Form Atomic 
  3.    BackColor       =   &H00C0C0C0&
  4.    BorderStyle     =   3  'Fixed Double
  5.    Caption         =   "Call the Atomic Clock"
  6.    ClientHeight    =   4665
  7.    ClientLeft      =   2160
  8.    ClientTop       =   1995
  9.    ClientWidth     =   4695
  10.    ClipControls    =   0   'False
  11.    Height          =   5100
  12.    Left            =   2085
  13.    LinkTopic       =   "Form1"
  14.    MaxButton       =   0   'False
  15.    MinButton       =   0   'False
  16.    ScaleHeight     =   4665
  17.    ScaleWidth      =   4695
  18.    Top             =   1635
  19.    Width           =   4845
  20.    Begin TextBox InitString 
  21.       BackColor       =   &H00FFFFFF&
  22.       Height          =   300
  23.       Left            =   390
  24.       TabIndex        =   6
  25.       Text            =   "ATZ"
  26.       Top             =   1710
  27.       Width           =   4080
  28.    End
  29.    Begin MSComm Comm1 
  30.       InBufferSize    =   2048
  31.       Interval        =   1000
  32.       Left            =   3390
  33.       NullDiscard     =   -1  'True
  34.       OutBufferSize   =   2048
  35.       RTSEnable       =   -1  'True
  36.       Top             =   1125
  37.    End
  38.    Begin SSCheck DST 
  39.       Caption         =   "Use Daylight Savings Time"
  40.       Height          =   285
  41.       Left            =   225
  42.       TabIndex        =   4
  43.       Top             =   960
  44.       Width           =   2640
  45.    End
  46.    Begin ComboBox TimeZone 
  47.       BackColor       =   &H00FFFFFF&
  48.       Height          =   300
  49.       Left            =   375
  50.       Style           =   2  'Dropdown List
  51.       TabIndex        =   3
  52.       Top             =   450
  53.       Width           =   4065
  54.    End
  55.    Begin CommandButton Command1 
  56.       Cancel          =   -1  'True
  57.       Caption         =   "Cancel"
  58.       Height          =   345
  59.       Index           =   2
  60.       Left            =   2370
  61.       TabIndex        =   1
  62.       Top             =   4020
  63.       Width           =   2085
  64.    End
  65.    Begin CommandButton Command1 
  66.       Caption         =   "Dial"
  67.       Default         =   -1  'True
  68.       Height          =   345
  69.       Index           =   1
  70.       Left            =   2370
  71.       TabIndex        =   0
  72.       Top             =   3510
  73.       Width           =   2070
  74.    End
  75.    Begin CommandButton Command1 
  76.       Caption         =   "Reset Defaults"
  77.       Height          =   345
  78.       Index           =   0
  79.       Left            =   2370
  80.       TabIndex        =   14
  81.       Top             =   3000
  82.       Width           =   2070
  83.    End
  84.    Begin SSFrame Frame3D1 
  85.       Caption         =   "COM Port"
  86.       ForeColor       =   &H00000000&
  87.       Height          =   1530
  88.       Left            =   255
  89.       TabIndex        =   9
  90.       Top             =   2910
  91.       Width           =   1965
  92.       Begin SSOption ComPort 
  93.          Caption         =   "COM&4:"
  94.          ForeColor       =   &H00000000&
  95.          Height          =   240
  96.          Index           =   3
  97.          Left            =   135
  98.          TabIndex        =   13
  99.          Top             =   1185
  100.          Width           =   780
  101.       End
  102.       Begin SSOption ComPort 
  103.          Caption         =   "COM&3:"
  104.          ForeColor       =   &H00000000&
  105.          Height          =   240
  106.          Index           =   2
  107.          Left            =   135
  108.          TabIndex        =   12
  109.          Top             =   885
  110.          Width           =   780
  111.       End
  112.       Begin SSOption ComPort 
  113.          Caption         =   "COM&2:"
  114.          ForeColor       =   &H00000000&
  115.          Height          =   240
  116.          Index           =   1
  117.          Left            =   135
  118.          TabIndex        =   11
  119.          Top             =   585
  120.          Width           =   780
  121.       End
  122.       Begin SSOption ComPort 
  123.          Caption         =   "COM&1:"
  124.          ForeColor       =   &H00000000&
  125.          Height          =   240
  126.          Index           =   0
  127.          Left            =   135
  128.          TabIndex        =   10
  129.          Top             =   285
  130.          Width           =   780
  131.       End
  132.    End
  133.    Begin TextBox DialString 
  134.       BackColor       =   &H00FFFFFF&
  135.       Height          =   300
  136.       Left            =   375
  137.       TabIndex        =   8
  138.       Text            =   "ATDT 1 303 494-4774"
  139.       Top             =   2430
  140.       Width           =   4080
  141.    End
  142.    Begin Label Label1 
  143.       BackStyle       =   0  'Transparent
  144.       Caption         =   "Modem Initialization String"
  145.       Height          =   210
  146.       Index           =   2
  147.       Left            =   240
  148.       TabIndex        =   5
  149.       Top             =   1440
  150.       Width           =   2415
  151.    End
  152.    Begin Label Status 
  153.       Alignment       =   1  'Right Justify
  154.       BackStyle       =   0  'Transparent
  155.       Height          =   240
  156.       Left            =   1125
  157.       TabIndex        =   15
  158.       Top             =   15
  159.       Width           =   3300
  160.    End
  161.    Begin Label Label1 
  162.       BackStyle       =   0  'Transparent
  163.       Caption         =   "Modem Dial String"
  164.       Height          =   210
  165.       Index           =   1
  166.       Left            =   225
  167.       TabIndex        =   7
  168.       Top             =   2160
  169.       Width           =   2145
  170.    End
  171.    Begin Label Label1 
  172.       BackStyle       =   0  'Transparent
  173.       Caption         =   "Time Zone"
  174.       Height          =   240
  175.       Index           =   0
  176.       Left            =   195
  177.       TabIndex        =   2
  178.       Top             =   165
  179.       Width           =   1320
  180.    End
  181. End
  182. Option Explicit
  183.  
  184. Dim ControlsDisabled As Integer
  185. Dim Instring As String
  186. Dim TString As String
  187. Dim Aborted As Integer
  188.  
  189. '
  190.                              'DESCRIPTION OF THE
  191.                  'AUTOMATED COMPUTER TELEPHONE SERVICE (ACTS)
  192. '
  193. '
  194. 'The following is transmitted (at 1200 Baud) after completion of the
  195. 'telephone connection.
  196. '
  197.              '? = HELP
  198.              'National Institute of Standards and Technology
  199.              'Telephone Time Service
  200. '
  201.                                      'D  L D
  202.               'MJD  YR MO DA H  M  S  ST S UT1 msADV        <OTM>
  203.              '47999 90-04-18 21:39:15 50 0 +.1 045.0 UTC(NIST) *
  204.              '47999 90-04-18 21:39:16 50 0 +.1 045.0 UTC(NIST) *
  205.              '47999 90-04-18 21:39:17 50 0 +.1 045.0 UTC(NIST) *
  206.              '47999 90-04-18 21:39:18 50 0 +.1 045.0 UTC(NIST) *
  207.              '47999 90-04-18 21:39:19 50 0 +.1 037.6 UTC(NIST) #
  208.              '47999 90-04-18 21:39:20 50 0 +.1 037.6 UTC(NIST) #
  209.              'etc..etc...etc.......
  210. '
  211. 'UTC = Universal Time Coordinated, the official world time referred to the
  212. 'zero meridian.
  213. '_________________________________________________________________________
  214. '
  215. 'DST = Daylight savings time characters, valid for the continental U.S., are
  216. 'set as follows:
  217.   '00 = We are on standard time (ST).    50 = We are on DST.
  218.   '99 to 51 = Now on ST, go to DST when your local time is 2:00 am and the
  219.     'count is 51.  The count is decremented daily at 00 (UTC).
  220.   '49 to 01 = Now on DST, go to ST when your local time is 2:00 am and the
  221.     'count is 01.  The count is decremented daily at 00 (UTC).
  222. 'The two DST characters provide up to 48 days advance notice of a change in
  223. 'time.  The count remains at 00 or 50 at other times.
  224. '_________________________________________________________________________
  225. '
  226. 'LS = Leap second flag is set to "1" to indicate that a leap second is to be
  227. 'added as 23:59:60 (UTC) on the last day of the current UTC month.  The LS
  228. 'flag will be reset to "0" starting with 23:59:60 (UTC).  The flag will
  229. 'remain on for the entire month before the second is added.  Leap seconds
  230. 'are added as needed at the end of any month.  Usually June and/or December
  231. 'are chosen.
  232. '
  233. '__________________________________________________________________________
  234. ''
  235. 'DUT1 = Approximate difference between earth rotation time (UT1) and UTC, in
  236. 'steps of 0.1 second.         DUT1 = UT1 - UTC
  237. '___________________________________________________________________________
  238. ''
  239. 'MJD = Modified Julian Date, often used to tag certain scientific data.
  240. '___________________________________________________________________________
  241. ''
  242. 'The full time format is sent at 1200 Baud, 8 bit, 1 stop, no parity.
  243. 'The format at 300 Baud is also 8 bit, 1 stop, no parity.
  244. 'At 300 Baud the MJD and DUT1 values are deleted and the
  245. 'time is transmitted only on even seconds.
  246. '___________________________________________________________________________
  247. ''
  248. 'Maximum on line time will be 56 seconds.  If all lines are busy at any time,
  249. 'the oldest call will be terminated if it has been on line more than 28
  250. 'seconds, else, the call that first reaches 28 seconds will be terminated.
  251. '___________________________________________________________________________
  252. ''
  253. 'Current time is valid at the "on-time" marker (OTM), either "*" or "#".
  254. 'The nominal on-time marker (*) will be transmitted 45 ms early to account
  255. 'for the 8 ms required to send 1 character at 1200 Baud, plus an additional
  256. '7 ms for delay from NIST to the user, and approximately 30 ms "scrambler"
  257. 'delay inherent in 1200 Baud modems.  If the caller echoes all characters,
  258. 'NIST will measure the round trip delay and advance the on-time marker so
  259. 'that the midpoint of the stop bit arrives at the user on time.  The amount
  260. 'of msADV will reflect the actual required advance in milliseconds and the
  261. 'OTM will be a "#".  The NIST system requires 4 or 5 consecutive delay
  262. 'measurements which are consistent before switching from "*" to "#".
  263. 'If the user has a 1200 Baud modem with the same internal delay as that used
  264. 'by NIST, then the "#" OTM should arrive at the user within +-2 ms of the
  265. 'correct time.  However, NIST has studied different brands of 1200 Baud
  266. 'modems and found internal delays from 24 ms to 40 ms and offsets of the
  267. '"#" OTM of +-10 ms.  For many computer users, +-10 ms accuracy should be
  268. 'more than adequate since many computer internal clocks can only be set with
  269. 'granularity of 20 to 50 ms.  In any case, the repeatability of the offset
  270. 'for the "#" OTM should be within +-2 ms, if the dial-up path is reciprocal
  271. 'and the user doesn't change the brand or model of modem used. This should
  272. 'be true even if the dial-up path on one day is a land-line of less than
  273. '40 ms (one way) and on the next day is a satellite link of 260 to 300 ms.
  274. 'In the rare event that the path is one way by satellite and the other way
  275. 'by land line with a round trip measurement in the range of 90 to 260 ms,
  276. 'the OTM will remain a "*" indicating 45 ms advance.
  277. '___________________________________________________________________________
  278. '''
  279. 'For user comments write:
  280. 'NIST-ACTS
  281. 'Time and Frequency Division
  282. 'Mail Stop 524
  283. '325 Broadway
  284. 'Boulder, CO  80303
  285. '
  286. 'Software for setting (PC)DOS compatable machines is available
  287. 'on a 360-kbyte diskette for $35.00 from:
  288. 'NIST Office of Standard Reference Materials
  289. 'B311-Chemistry Bldg, NIST, Gaithersburg, MD, 20899, (301) 975-6776
  290. '
  291. '--------------------------------------------------------------------------
  292.  
  293. Sub Command1_Click (Index As Integer)
  294. Dim StartTime As Double
  295. Dim I As Integer
  296. Dim NewD As Double
  297. Dim OldD As Double
  298. Dim DSTFlag As String
  299. Dim OffBy As String
  300. Dim Cmd$, CommLen%
  301. Dim T$
  302.  
  303. If Index = 0 Then  'Reset Defaults
  304.    ResetDefaults
  305.    Status.Caption = ""
  306. End If
  307.  
  308. If Index = 1 Then  'Dial
  309.    SaveModemSettings
  310.    Aborted = False
  311.    Status.Caption = ""
  312.  
  313.    Command1(0).Enabled = False
  314.    Command1(1).Enabled = False
  315.    TimeZone.Enabled = False
  316.    DST.Enabled = False
  317.    DialString.Enabled = False
  318.    InitString.Enabled = False
  319.    Frame3D1.Enabled = False
  320.    ControlsDisabled = True
  321.    On Local Error GoTo ErrHndl
  322.    For I% = 0 To 3
  323.      If ComPort(I%).Value Then Comm1.CommPort = I% + 1
  324.    Next I%
  325.    If Aborted Then Exit Sub
  326.    Comm1.Settings = "1200,N,8,1"
  327.    If Aborted Then Exit Sub
  328.    Comm1.PortOpen = True
  329.    If Aborted Then Exit Sub
  330.  
  331. 'Debug.Print comm1.InBufferCount
  332.  
  333.    Cmd$ = InitString.Text + Chr$(13) + Chr(10)
  334.    CommLen% = Len(Cmd$)
  335.    Comm1.Output = Cmd$
  336.  
  337. 'Debug.Print comm1.InBufferCount
  338.  
  339.    StartTime = Timer
  340.    LastTime = 0
  341.    Do
  342.       DoEvents
  343.       If LastTime <> Int(Timer) Then
  344.          If Not Aborted Then Status.Caption = "Initial - " + Format$(10 - Int(Timer - StartTime)) + " seconds until timeout."
  345.          LastTime = Int(Timer)
  346.       End If
  347.    Loop Until Comm1.InBufferCount > CommLen% + 5 Or ((Timer - StartTime) > 10) Or Aborted
  348.    If Aborted Then Exit Sub
  349.  
  350.    Instring$ = Comm1.Input
  351.    If Instring$ = "" Then
  352.       Status.Caption = ""
  353.       MsgBox "No response from modem."
  354.       EnableControls
  355.       Exit Sub
  356.    End If
  357.    'Debug.Print ">"; instring$; "<"
  358.  
  359.    DoEvents
  360.    While Comm1.InBufferCount > 0
  361.    DoEvents
  362.    DoEvents
  363.    DoEvents
  364.    DoEvents
  365.    DoEvents
  366.    DoEvents
  367.    Instring$ = Comm1.Input
  368.    'Debug.Print ">"; instring$; "<"
  369.    Wend
  370.    
  371.    StartTime = Timer
  372.    LastTime = 0
  373. While (Timer - StartTime) < 3
  374. DoEvents
  375.       If LastTime <> Int(Timer) Then
  376.          If Not Aborted Then Status.Caption = "Waiting - " + Format$(3 - Int(Timer - StartTime)) + " seconds."
  377.          LastTime = Int(Timer)
  378.       End If
  379. Wend
  380.  
  381.    If Aborted Then Exit Sub
  382.    Instring$ = Comm1.Input
  383.    'Debug.Print ">"; instring$; "<"
  384.    
  385.    Comm1.Output = DialString.Text + Chr$(13) + Chr(10)
  386.    StartTime = Timer
  387.    LastTime = 0
  388.    Do
  389.       DoEvents
  390.       If LastTime <> Int(Timer) Then
  391.          If Not Aborted Then
  392.              T$ = "Connecting - "
  393.              If Comm1.InBufferCount > 50 Then T$ = "Connected - "
  394.              Status.Caption = T$ + Format$(75 - Int(Timer - StartTime)) + " seconds until timeout."
  395.          End If
  396.          LastTime = Int(Timer)
  397.       End If
  398.    Loop Until (Comm1.InBufferCount >= 500) Or ((Timer - StartTime) > 75) Or Aborted
  399.    If Aborted Then Exit Sub
  400.    
  401.    If (Timer - StartTime) > 75 Then
  402.          Status.Caption = "Timed out."
  403.          Exit Sub
  404.    End If
  405.    
  406.    Status.Caption = "Setting time."
  407.    DoEvents
  408.    If Aborted Then Exit Sub
  409.    Instring$ = Comm1.Input
  410.    Instring$ = Right$(Instring$, 120)
  411.    Instring$ = Mid$(Instring$, InStr(Instring$, "*") + 1, 80)
  412.     
  413.  
  414.    NewD = DateValue(Mid$(Instring$, 12, 2) + "/" + Mid$(Instring$, 15, 2) + "/" + Mid$(Instring$, 9, 2))
  415.    NewD = NewD + TimeValue(Mid$(Instring$, 18, 8))
  416.    
  417.    NewD = NewD - (TimeZone.ListIndex - 11) * (1 / 24)
  418.    DSTFlag$ = Mid$(Instring$, 27, 2)
  419.    'If ((DSTFlag >= "01") And (DSTFlag <= "50")) Then
  420.    '   NewD = NewD - (1 / 24)
  421.    'End If
  422.    If DST.Value Then
  423.       NewD = NewD + (1 / 24)
  424.    End If
  425.    OldD = Date + Time
  426.    If Year(NewD) >= 1993 Then
  427.       Date = Format$(NewD, "mm/dd/yy")
  428.       Time = Format$(NewD, "hh:mm:ss")
  429.       If OldD > NewD Then
  430.          OffBy = "fast"
  431.       Else
  432.          OffBy = "slow"
  433.       End If
  434.       MsgBox "Time set to " + Format$(NewD, "hh:mm:ss") + ".  Clock was " + OffBy$ + " by " + Format$(Abs(NewD - OldD), "hh:mm:ss") + "."
  435.       Screen.MousePointer = 11
  436.       AtomicTimeWasSet = True
  437.       Status.Caption = "Time set."
  438.    Else
  439.       MsgBox "Error getting date and time."
  440.    End If
  441.    
  442.    If Aborted Then Exit Sub
  443.    Screen.MousePointer = 11
  444.    HangUp
  445.    Screen.MousePointer = 0
  446.    If Aborted Then Exit Sub
  447.    On Local Error Resume Next
  448.    
  449.    Unload Atomic
  450.  
  451. End If
  452.  
  453. If Index = 2 Then  'Cancel
  454.    If ControlsDisabled Then
  455.       Screen.MousePointer = 11
  456.       Status.Caption = "Cancelling."
  457.       HangUp
  458.       EnableControls
  459.       Aborted = True
  460.       Status.Caption = "Aborted."
  461.       Screen.MousePointer = 0
  462.    Else
  463.       Unload Atomic
  464.    End If
  465. End If
  466.  
  467. EnableControls
  468. Exit Sub
  469.  
  470.  
  471. ErrHndl:
  472. If Instring$ <> "" Then
  473.    MsgBox "Error: " + Error(Err) + Chr$(13) + Chr$(10) + "Contents of buffer: " + Instring$
  474. Else
  475.    MsgBox "Error: " + Error(Err)
  476. End If
  477.  
  478. If Comm1.PortOpen Then Comm1.PortOpen = False
  479.  
  480. Aborted = True
  481. EnableControls
  482. Resume Next
  483. Exit Sub
  484. End Sub
  485.  
  486. Sub DialString_GotFocus ()
  487. DialString.SelStart = 0
  488. DialString.SelLength = 32767
  489.  
  490. End Sub
  491.  
  492. Sub EnableControls ()
  493.    Command1(0).Enabled = True
  494.    Command1(1).Enabled = True
  495.    TimeZone.Enabled = True
  496.    DST.Enabled = True
  497.    DialString.Enabled = True
  498.    InitString.Enabled = True
  499.    Frame3D1.Enabled = True
  500.    ControlsDisabled = False
  501.    If Comm1.PortOpen Then Comm1.PortOpen = False
  502. End Sub
  503.  
  504. Sub Form_Load ()
  505. Atomic.Left = Settings.Left + (Settings.Width / 2) - (Atomic.Width / 2)
  506. Atomic.Top = Settings.Top + (Settings.Height / 2) - (Atomic.Height / 2)
  507.  
  508. TimeZone.AddItem "Greenwich + 11"
  509. TimeZone.AddItem "Greenwich + 10"
  510. TimeZone.AddItem "Greenwich + 9"
  511. TimeZone.AddItem "Greenwich + 8"
  512. TimeZone.AddItem "Greenwich + 7"
  513. TimeZone.AddItem "Greenwich + 6"
  514. TimeZone.AddItem "Greenwich + 5"
  515. TimeZone.AddItem "Greenwich + 4"
  516. TimeZone.AddItem "Greenwich + 3"
  517. TimeZone.AddItem "Greenwich + 2"
  518. TimeZone.AddItem "Greenwich + 1"
  519. TimeZone.AddItem "Greenwich"
  520. TimeZone.AddItem "Greenwich - 1"
  521. TimeZone.AddItem "Greenwich - 2"
  522. TimeZone.AddItem "Greenwich - 3"
  523. TimeZone.AddItem "Atlantic Standard Time (4)"
  524. TimeZone.AddItem "Eastern Standard Time"
  525. TimeZone.AddItem "Central Time"
  526. TimeZone.AddItem "Mountain Time"
  527. TimeZone.AddItem "Pacific Time"
  528. TimeZone.AddItem "Yukon Standard Time"
  529. TimeZone.AddItem "Alaska-Hawaii Standard Time"
  530. TimeZone.AddItem "Nome Standard Time"
  531. TimeZone.AddItem "Greenwich - 12"
  532. ResetDefaults
  533. LoadModemSettings
  534. 'Atomic.Show 1
  535. 'Command1(1).SetFocus
  536. End Sub
  537.  
  538. Sub HangUp ()
  539.    Dim StartTime As Double
  540.    Dim I As Integer
  541.    Dim Ret As Integer
  542.  
  543.    'Josh version  -
  544.    'comm1.PortOpen = False
  545.    'Exit Sub
  546.  
  547.  
  548.  
  549.  
  550.    'Beep
  551.    On Local Error GoTo ErrHndl2
  552.    'comm1.Output = "+++"
  553.    'StartTime = Timer
  554.    'While Timer - StartTime < .5
  555.    '  DoEvents
  556.    'Wend
  557.    'comm1.Output = "ATH0" + Chr$(13) + Chr(10)
  558.    Comm1.Output = ""
  559.    For I% = 1 To 3
  560.    StartTime = Timer
  561.    TString$ = Comm1.Input
  562.    Comm1.Output = "+"
  563.    While Timer - StartTime < .25
  564.      DoEvents
  565.    Wend
  566.    Next I%
  567.  
  568.    'Do
  569.    '   DoEvents
  570.    'Loop Until comm1.InBufferCount >= 2
  571.  
  572.    StartTime = Timer
  573.    While Timer - StartTime < 3#
  574.      DoEvents
  575.    Wend
  576.    
  577.    TString$ = Comm1.Input
  578.    Comm1.Output = "ATH0" + Chr(13) + Chr(10)
  579.    StartTime = Timer
  580.    Do
  581.       DoEvents
  582.    Loop Until Comm1.InBufferCount >= 2 Or (Timer - StartTime) > 5
  583.    TString$ = Comm1.Input
  584.  
  585.    StartTime = Timer
  586.    While Timer - StartTime < 1#
  587.      DoEvents
  588.    Wend
  589.    
  590.    '3/28/92 version
  591.    Comm1.PortOpen = False
  592.    Exit Sub
  593.  
  594.    
  595.    Comm1.Output = "+++"
  596.    StartTime = Timer
  597.    While Timer - StartTime < .5
  598.      DoEvents
  599.    Wend
  600.    Comm1.Output = "ATH0" + Chr$(13) + Chr(10)
  601.  
  602.    Ret = Comm1.DTREnable     'Save current setting
  603.    Comm1.DTREnable = True    'Turn DTR on
  604.      DoEvents
  605.    Comm1.DTREnable = False   'Turn DTR off
  606.      DoEvents
  607.    Comm1.DTREnable = Ret     'Restore old setting
  608.    
  609.    Comm1.PortOpen = False
  610.  
  611. ErrHndl2:
  612.   EnableControls
  613.   Exit Sub
  614. End Sub
  615.  
  616. Sub InitString_GotFocus ()
  617. InitString.SelStart = 0
  618. InitString.SelLength = 32767
  619.  
  620. End Sub
  621.  
  622. Sub LoadModemSettings ()
  623. Dim lpReturnedString As String * 100
  624. Dim a As Integer
  625.  
  626. lpReturnedString = Space$(100)
  627. a% = MyGetProfileString("AllTheTime", "TimeZoneIndex", "16", lpReturnedString$, 100)
  628. TimeZone.ListIndex = Val(lpReturnedString)
  629.  
  630. a% = MyGetProfileString("AllTheTime", "DST", "0", lpReturnedString$, 100)
  631. DST.Value = Val(lpReturnedString)
  632.  
  633. a% = MyGetProfileString("AllTheTime", "DialString", "ATDT 1 303 494-4774", lpReturnedString$, 100)
  634. DialString.Text = Trim$(lpReturnedString)
  635.  
  636. a% = MyGetProfileString("AllTheTime", "ModemInitString", "ATZ", lpReturnedString$, 100)
  637. InitString.Text = Trim$(lpReturnedString)
  638.  
  639. a% = MyGetProfileString("AllTheTime", "ComPort", "0", lpReturnedString$, 100)
  640. ComPort(Val(lpReturnedString)).Value = True
  641. End Sub
  642.  
  643. Sub ResetDefaults ()
  644.    TimeZone.ListIndex = 16
  645.    DST.Value = 0
  646.    DialString.Text = "ATDT 1 303 494-4774"
  647.    InitString.Text = "ATZ"
  648.    ComPort(0).Value = True
  649.    'LoadModemSettings
  650. End Sub
  651.  
  652. Sub SaveModemSettings ()
  653. Dim a As Integer
  654. Dim M As String
  655. Dim I As Integer
  656.  
  657. a% = WritePrivateProfileString("AllTheTime", "TimeZoneIndex", TimeZone.ListIndex, "ATT.INI")
  658. a% = WritePrivateProfileString("AllTheTime", "DST", DST.Value, "ATT.INI")
  659. a% = WritePrivateProfileString("AllTheTime", "DialString", DialString.Text, "ATT.INI")
  660. a% = WritePrivateProfileString("AllTheTime", "ModemInitString", InitString.Text, "ATT.INI")
  661. M$ = "0"
  662. For I% = 0 To 3
  663.    If ComPort(I%).Value Then M$ = Str$(I%)
  664. Next I%
  665. a% = WritePrivateProfileString("AllTheTime", "ComPort", M$, "ATT.INI")
  666.  
  667. End Sub
  668.  
  669.